{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import QUANTAXIS as QA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 在进行完回测以后 我们可以在web上进行访问 也可以通过python来对于回测结果进行分析\n",
    "\n",
    "# 首先我们需要知道这次回测的cookie_id\n",
    "# 你可以通过查看web上的路径名来找到该cookie\n",
    "# 如: http://localhost:8080/#/personal/history/0.9828496584869914\n",
    "# cookie_id 为0.9828496584869914"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "res=QA.backtest_result_analyzer(cookie_id=input('cookie_id is :  '))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取利润最多的N笔交易\n",
    "res.get_profit_trade(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取亏损最多的N笔交易\n",
    "res.get_loss_trade(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取某一只股票的交易记录\n",
    "res.get_stock_tradehistory('000001')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取某一只股票的买卖对照表\n",
    "res.get_stock_tradedetail('000001')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#获取某一次成交的市场表现\n",
    "rx=res.get_profit_trade(1)\n",
    "res.get_trade_marketdata(rx)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
